package noUsed;

import general.Mechanisme;
import graphique.C;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.DisplayMode;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;

import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLCapabilities;
import javax.swing.JFrame;

import com.sun.opengl.util.Animator;

public class Fenetre extends JFrame
{
	Container pane;

	Mechanisme m;

	Fenetre f;
	
	GLCanvas canvas;

	public Fenetre( Mechanisme m )
	{
		super( "IA_JEUX" );
		
		this.f = this;
	    this.m = m;
	    // Set up window
	    
	    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	    
	    this.setResizable(false);
	    this.setLayout(new BorderLayout());
	    GLCanvas canvas = new GLCanvas(new GLCapabilities());
	    canvas.setSize(C.taille, C.taille);
	    Animator animator = new Animator(canvas);
	    Dessinateur listener = new Dessinateur( m );
	    canvas.addGLEventListener(listener);
	    canvas.addMouseMotionListener(listener);
	    canvas.addMouseWheelListener(listener);
	    this.add(canvas, BorderLayout.CENTER);

	    this.pack();
	    this.show();

	    animator.start();
	}
}
